/*
 *  This file is part of LifeBudget - Copyright 2010 Clifton Eaton
 *  ------------------------------------------------------------------
 *  LifeBudget is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  LifeBudget is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with LifeBudget.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.lifebudget.app.client.mvc.model;

import java.io.Serializable;

import com.extjs.gxt.ui.client.data.BeanModelTag;
import com.extjs.gxt.ui.client.data.ModelData;

/**
 * Represents a Category or envelope in the LifeBudget budgeting metaphor. Contains
 * all of the fields to describe a category. A Category can be one of two types, a default
 * Category or a regular, user-created Category.  Every user should have a default category
 * so that LifeBudget will have a place to put extra funds in when a {@link PaycheckCalculator} 
 * is applied. Serves as model object to the view as well as a Data Transfer Object and 
 * therefore, meant to be used only in the client code or for communicating to through GWT RPC.
 */
public class Category implements Serializable, BeanModelTag {

	/** The name. */
	private String name;
	
	/** The description. */
	private String description;
	
	/** The archived. */
	private boolean archived;
	
	/** The id. */
	private long id;
	
	/** The default category. */
	private boolean defaultCategory;

	/**
	 * Instantiates a new category.
	 */
	public Category() {

	}

	/**
	 * Instantiates a new category from a {@link ModelData} instance.
	 *
	 * @param model the model
	 */
	public Category(ModelData model) {

	}

	/**
	 * Instantiates a new category.
	 *
	 * @param name the name
	 * @param description the description
	 */
	public Category(String name, String description) {
		super();
		this.name = name;
		this.description = description;
	}

	/**
	 * Instantiates a new category.
	 *
	 * @param id the id
	 * @param name the name
	 * @param description the description
	 * @param archived the archived
	 */
	public Category(long id, String name, String description, boolean archived) {
		super();
		this.name = name;
		this.description = description;
		this.archived = archived;
		this.id = id;
	}

	/**
	 * Gets the name.
	 *
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the name.
	 *
	 * @param name the new name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Gets the description.
	 *
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * Sets the description.
	 *
	 * @param description the new description
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * Checks if is archived.
	 *
	 * @return true, if is archived
	 */
	public boolean isArchived() {
		return archived;
	}

	/**
	 * Sets the archived.
	 *
	 * @param archived the new archived
	 */
	public void setArchived(boolean archived) {
		this.archived = archived;
	}

	/**
	 * Gets the id.
	 *
	 * @return the id
	 */
	public long getId() {
		return id;
	}

	/**
	 * Sets the id.
	 *
	 * @param id the new id
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * Sets the default category.
	 *
	 * @param defaultCategory the new default category
	 */
	public void setDefaultCategory(boolean defaultCategory) {
		this.defaultCategory = defaultCategory;
	}

	/**
	 * Checks if this category is the default category.
	 *
	 * @return true, if is default category
	 */
	public boolean isDefaultCategory() {
		return defaultCategory;
	}

}
